package com.example.echoewish.repository.database;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.example.echoewish.pojo.ChatEntity;
import com.example.echoewish.repository.database.dao.ChatEntityDao;

@Database(version = 1,entities = {ChatEntity.class})
public abstract class ChatEntityDataBase extends RoomDatabase {
    private static ChatEntityDataBase Instance;

    public abstract ChatEntityDao getChatEntityDao();

    public static synchronized ChatEntityDataBase getDatabase(Context context)
    {
        if (Instance==null)
        {
            Instance= Room.databaseBuilder(context.getApplicationContext(),ChatEntityDataBase.class,"chatEntity_database")
                    .allowMainThreadQueries().build();
        }
        return Instance;
    }

}
